#ifndef MAINDIALOG_H
#define MAINDIALOG_H

#include <QDialog>
#include <QTcpSocket>
#include <QHostAddress>
#include <QFile>
#include <QJsonDocument>
#include <QJsonObject>
#include <QTextEdit>

#include <../common/message.h>

QT_BEGIN_NAMESPACE
namespace Ui {
class MainDialog;
}
QT_END_NAMESPACE

class MainDialog : public QDialog
{
    Q_OBJECT

public:
    MainDialog(QWidget *parent = nullptr);
    ~MainDialog();
    void login(QString);

private:
    Ui::MainDialog *ui;
    bool isLogin;
    QString userName;
    QTcpSocket *tcpSocket;
    QList<QString> userList;;

    void addNewUser(QString);
    void removeUser(QString);

public slots:
    void dataReceive();

};
#endif // MAINDIALOG_H
